import Application from '../application';

export const notFoundTask = () => {
    const app = Application.Instance.getApp();
    app.use(async (ctx) => {
        ctx.status = 404;

        switch (ctx.accepts('html', 'json')) {
            case 'html':
                ctx.type = 'html';
                ctx.body = '<p>The Page Not Found</p>';
                break;
            case 'json':
                ctx.body = {
                    message: 'Page Not Found'

                };
                break;
            default:
                ctx.type = 'text';
                ctx.body = 'Page Not Found';
        }
    });
};
